package com.istock.union.user.util;

import com.istock.union.user.model.ConfigInfo;
import com.istock.union.user.service.ConfigInfoService;

/**
 * 系统参数的访问入口
 * 规范系统参数的访问
 * @author senvon
 *
 */
public class Configs {

	private Configs(){}
	private static Configs instance = new Configs();
	
	public static Configs getInstance(){
		if(instance==null)
		{
			synchronized (Configs.class) {
				if(instance == null){
					instance = new Configs();
				}
			}
		}
		return instance;
	}
	
	private ConfigInfoService configInfoService;
	
	public void setConfigInfoService(ConfigInfoService configInfoService){
		this.configInfoService = configInfoService;
	}
	
	public String findByKey(String key){
		ConfigInfo configInfo = configInfoService.findByKey(key);
		if(configInfo != null){
			return configInfo.getConfigValue();
		}
		return null;
	}
	
	
}
